package cn.ssq.service.impl;

import cn.ssq.dao.AddressCityMapper;
import cn.ssq.dao.AddressProvinceMapper;
import cn.ssq.dao.AddressTownMapper;
import cn.ssq.domain.AddressCity;
import cn.ssq.domain.AddressProvince;
import cn.ssq.domain.AddressTown;
import cn.ssq.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class AddressServiceImpl implements AddressService {
    @Autowired
    private AddressCityMapper addressCityMapper;
    @Autowired
    private AddressProvinceMapper addressProvinceMapper;
    @Autowired
    private AddressTownMapper addressTownMapper;

    /**
     * 查询省市级
     * @return 省市级的map集合
     */
    @Override
    public Map selectAddress() {
        Map map = new HashMap();

        List<AddressCity> cityList = addressCityMapper.selectCity();
        List<AddressProvince> provinceList = addressProvinceMapper.selectProvidence();
        List<AddressTown> townList = addressTownMapper.selectTown();
        map.put("cityList",cityList);
        map.put("provinceList",provinceList);
        map.put("townList",townList);
        return map;
    }
}
